#!/bin/bash
set +x
set -e
function getbakdir(){
  bakarray=`find /data/ymsworkspace/dockertardone -name bak`
  for var in ${bakarray[@]}
  do
    echo $var
    processbak $var
  done

}
#处理bak文件夹

function processbak(){
	for dir in ${1}/*
	do
		if test -d $dir
		then
			echo ${dir}
			ls -t ${dir}| sed -n '2,$p'|sed 's:^:'$dir'/:'|xargs -I {} echo rm -rf {}
		fi
	done
}
getbakdir
